/*
 * @Author: wangqizhang
 * @Date: 2024-04-24 10:36:59
 * @LastEditors: wangqizhang
 * @LastEditTime: 2024-04-29 20:45:26
 * @FilePath: /suixinji-react/src/untils/index.ts
 * @Description:
 *
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
 */
//浏览器全屏
export const fullScreen = () => {
  const isScreen = localStorage.getItem('isScreen');
  if (isScreen && isScreen === 'yes') {
    document.exitFullscreen();
    localStorage.setItem('isScreen', 'no');
  } else {
    document.documentElement.requestFullscreen();
    localStorage.setItem('isScreen', 'yes');
  }
};
//设置sessionStroage
export const setSessionStorage = (key: string, value: any) => {
  sessionStorage.setItem(key, JSON.stringify(value));
};
//获取sessionStroage
export const getSessionStorage = (key: string) => {
  return JSON.parse(sessionStorage.getItem(key) as string);
};
//  删除sessionStroage
export const removeSessionStorage = (key: string) => {
  sessionStorage.removeItem(key);
};
//存在 sessionStroage
export const hasSessionStorage = (key: string) => {
  return sessionStorage.getItem(key) ? true : false;
};
